#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    vector<int> twoSum(vector<int>& numbers, int target) {
        int n = numbers.size();
        for (int i = 0; i < n; i++)
        {
            int left = i + 1, right = n - 1;
            {
                while (left <= right)
                {
                    int mid = (right - left) / 2 + left;
                    int sum = numbers[i] + numbers[mid];
                    if (sum > target) right = mid - 1;
                    else if (sum < target) left = mid + 1;
                    else if (sum == target) return vector<int>({ i + 1, mid + 1 });
                }
            }
        }
        return vector<int>({ -1, -1 });
    }
};